<html>
    
    <head>
        <script type="text/javascript">
        function enviar(){
            var request = new XMLHttpRequest();

            request.open("GET", "/secured/prueba301_server.php", true );
                        
            request.setRequestHeader( 'Accept', 'application/vnd.copperforest.node+xml' );
            request.setRequestHeader( 'Referer', 'http://www.google.com' );

            request.onload = function() {
                if (this.status >= 200 && this.status < 400) {
                    //CUANDO ES UN CODIGO 300 DE REDIRECCIONAMIENTO??
                    alert(this.responseText)


                }
            };
            
            request.send();
        }    
        </script>
    </head>
    <body>
        <a href="#" onclick="enviar();return false">AQUI</a>
    </body>
        
</html>